/**
**************************************************************************************
*Palisma - Secrets of the Illuminati is an open-source 2D RPG                        *
*Copyright (C) 2006, Tony Sparks                                                     *
*                                                                                    *
*This library is free software; you can redistribute it and/or                       *
*modify it under the terms of the GNU Lesser General Public                          *
*License as published by the Free Software Foundation; either                        *
*version 2.1 of the License, or (at your option) any later version.                  *
*                                                                                    *
*This library is distributed in the hope that it will be useful,                     *
*but WITHOUT ANY WARRANTY; without even the implied warranty of                      *
*MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU                   *
*Lesser General Public License for more details.                                     *
*                                                                                    *
*You should have received a copy of the GNU Lesser General Public                    *
*License along with this library; if not, write to the Free Software                 *
*Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA      *
**************************************************************************************
*/
#pragma once
#pragma warning( disable : 4244)
#pragma warning( disable : 4018)
#pragma warning( disable : 4267)

#include <string>
#include <list>
#include <stdlib.h>


class StringUtil
{
public:
    StringUtil(void);
    StringUtil( std::string s);
    StringUtil( std::string s, char delim);

    bool HasNext() { return !tokens.empty(); };
    /** Get the next token */
    std::string GetNext() { 
        std::string t = tokens.front(); 
        tokens.pop_front();
        return t;
    };

    /** Amount of tokens */
    int Size() { return tokens.size(); };

    /*------------------------------------------
        Util functions
    -------------------------------------------*/

    template<class T> std::string ToString( T val );
    

    static float ToFloat(const std::string &str) {
        return atof( str.c_str() );
    };

    static int ToInt( const std::string &str) {
        return atoi( str.c_str() );
    };

    static float ToFloat(char *str) {
        return atof( str );
    };

    static int ToInt( char *str) {
        return atoi( str );
    };

    static bool IsNumber( std::string &str );

private:
    std::string str;
    std::list< std::string > tokens;
public:
    virtual ~StringUtil(void);
};



/*TODO - IMPLEMENT
template<class T>
std::string StringUtil_ToString(T val)
{
    std::ostringstream sstream;
    sstream << val;
    return sstream.str();
};


float StringUtil_ToFloat(const std::string &str) {
    return atof( str.c_str() );
};

int StringUtil_ToInt( const std::string &str) {
    return atoi( str.c_str() );
};

float StringUtil_ToFloat(char *str) {
    return atof( str );
};

int StringUtil_ToInt( char *str) {
    return atoi( str );
};
*/